home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 November: Tool Chest / Dev.CD Nov 98 TC.toast / Sample Code / Snippets / Development Tools & Languages / Bits o' MacApp Code / Text, Grid, List Views / ProtoViews.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-06-10  |  1.6 KB  |  72 lines  |  [TEXT/MPS ]

  1. #ifndef __PROTOVIEWS__
  2. #define __PROTOVIEWS__
  3.  
  4. #include <UGridView.h>
  5.  
  6. class TLineData: public TObject 
  7. {
  8.     private:
  9.         long    fOffset;
  10.         TFile *fMyFile;
  11.     public:
  12.         virtual pascal void ILineData(const long offset, 
  13.                                       TFile *aFile);
  14.         virtual pascal void GetText(CStr255 &theText);
  15. };
  16.  
  17. class TLineServer: public TObject
  18. {
  19.     private:
  20.         TList    *fLineList;
  21.         TFile    *fMyFile;
  22.     public:
  23.         virtual pascal void ILineServer(CStr255 &fileName);
  24.         virtual pascal void GetALine(const ArrayIndex theLine,
  25.                                      CStr255 &theText);
  26.         virtual pascal ArrayIndex GetLineCount();
  27.         virtual pascal void Free();
  28.         
  29. };
  30.  
  31. class TLineView: public TView
  32. {
  33.     private:
  34.         TLineServer        *fMyLineServer;
  35.     public:
  36.         virtual pascal void ILineView(TLineServer *aLineServer);
  37.         virtual pascal void Draw(const VRect& area);
  38. };
  39.  
  40. // The TListView class implements the line server approach for the 
  41. // single column "TTextListView"
  42.  
  43. class TListView: public TTextListView
  44. {
  45.     private:
  46.         TLineServer        *fMyLineServer;
  47.     public:
  48.         virtual pascal void IListView(TLineServer *aLineServer);
  49.         virtual pascal void GetItemText(short item,
  50.                                        CStr255& aString);
  51. };
  52.  
  53.  
  54. // The TMatrixView implements the line server approach for TTextGridView
  55. // type views. The assumption is that the data in the file is in ROW order, 
  56. // that is, for a three column grid:
  57. // Element r1,c1
  58. // Element r1,c2
  59. // Element r1,c3
  60. // Element r2,c1
  61. // Element r2,c2
  62. // Element r2,c3   etc.
  63.  
  64. class TMatrixView: public TTextGridView
  65. {
  66.     private:
  67.         TLineServer        *fMyLineServer;
  68.     public:
  69.         virtual pascal void IMatrixView(TLineServer *aLineServer);
  70.         virtual pascal void GetText(GridCell aCell, CStr255& aString);
  71. };
  72. #endif